/**
 * 2012-2-16
 * @author 李亚松
 * @email  lysong01@gmail.com
 * Creative.java
 */
package liyasong.love;

import java.util.ArrayList;
import java.util.Random;

public class Creative {
	/*
	 * 此方法从love数据库的词汇表中随机选取n个词，作为一个数组返回
	 */
	public static String[] generateWord(String[] wordlist, int m) { 
			Random num = new Random();
			ArrayList<String> arraylist = new ArrayList<String>();
			int n = wordlist.length;
			for (int i = 0; i < m; i++) {
				int j = num.nextInt(n) - 1;
				arraylist.add(wordlist[j]);
			}
			return arraylist.toArray(new String[0]);	//这里的0是什么意思呢？
	}
}
